/* eslint-disable */
<template>
  <el-container class="teacher-layout">
    <el-container>
      <el-header>
        <div class="header-left">
          <h2>学生作业管理系统 - 教师</h2>
        </div>
        <div class="header-right">
          <el-dropdown @command="handleCommand">
            <span class="el-dropdown-link">
              教师<i class="el-icon-arrow-down el-icon--right"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="profile">个人信息</el-dropdown-item>
              <el-dropdown-item command="logout">退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </el-header>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: 'TeacherLayout',
  methods: {
    handleCommand(command) {
      if (command === 'profile') {
        this.$router.push('/teacher/profile')
      } else if (command === 'logout') {
        localStorage.removeItem('token')
        this.$router.push('/login')
      }
    }
  }
}
</script>

<style scoped>
.teacher-layout {
  height: 100vh;
}

.el-header {
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,21,41,.08);
}

.header-right {
  cursor: pointer;
}

.el-dropdown-link {
  color: #303133;
}

.el-main {
  background-color: #f0f2f5;
  padding: 20px;
}
</style> 